#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<assert.h>
using namespace std;
typedef double(*PF)(double x);

double CalcIntegral(PF pf, double a, double b)
{
	int flag = 1;
	double sum = 0;
	const double unit = 1e-4;
	if (a > b)
	{
		flag = -1;
	}
	for (double i = a; i+unit <= b; i += unit)
	{
		sum += (pf(i) + pf(i + unit));
	}
	sum = sum*unit / 2;
	return sum;
}

double ones(double x)
{
	return x;
}
int main()
{
	cout << CalcIntegral(ones, 1, 2) << endl;
	return 0;
}
